import { _decorator,Component,Label, Sprite, SpriteFrame,Node} from "cc";
import { GameResult } from "../Cmd/GameResult";
import { Utils } from "../Common/Utils";
const { ccclass, property } = _decorator;
@ccclass
export  class GameResultItem extends Component {
   
   
    @property(Label)
    private ID!:Label;


    @property(Sprite)
    private Result1!:Sprite;

    
    @property(Sprite)
    private Result2!:Sprite;

    
    @property(Sprite)
    private Result3!:Sprite;

    @property(Label)
    private Prize!:Label;

    @property({ type: [SpriteFrame] })
    SpriteFram:SpriteFrame[] = [];



    public setData(data: any) {
        const itemData = data as GameResult;
        this.ID.string =itemData.id+'';
        this.Result1.spriteFrame = this.SpriteFram[itemData.randomArray[0]-1];
        this.Result2.spriteFrame = this.SpriteFram[itemData.randomArray[1]-1];
        this.Result3.spriteFrame = this.SpriteFram[itemData.randomArray[2]-1];
        this.Prize.string = Utils.num1000(itemData.prize) ; 
        
    }
}